package com.ruoyi.web.service.impl;

import java.util.List;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.mapper.ExaminationHospitalMapper;
import com.ruoyi.web.domain.ExaminationHospital;
import com.ruoyi.web.service.IExaminationHospitalService;
import com.ruoyi.common.core.text.Convert;

/**
 * 体检医院Service业务层处理
 * 
 * @author drx
 * @date 2025-05-19
 */
@Service
public class ExaminationHospitalServiceImpl implements IExaminationHospitalService 
{
    @Autowired
    private ExaminationHospitalMapper examinationHospitalMapper;

    /**
     * 查询体检医院
     * 
     * @param id 体检医院主键
     * @return 体检医院
     */
    @Override
    public ExaminationHospital selectExaminationHospitalById(Long id)
    {
        return examinationHospitalMapper.selectExaminationHospitalById(id);
    }

    /**
     * 查询体检医院列表
     * 
     * @param examinationHospital 体检医院
     * @return 体检医院
     */
    @Override
    public List<ExaminationHospital> selectExaminationHospitalList(ExaminationHospital examinationHospital)
    {
        return examinationHospitalMapper.selectExaminationHospitalList(examinationHospital);
    }

    /**
     * 新增体检医院
     * 
     * @param examinationHospital 体检医院
     * @return 结果
     */
    @Override
    public int insertExaminationHospital(ExaminationHospital examinationHospital)
    {
        examinationHospital.setCreateTime(DateUtils.getNowDate());
        examinationHospital.setCreateBy(ShiroUtils.getSysUser().getLoginName());
        examinationHospital.setCreateName(ShiroUtils.getSysUser().getUserName());

        examinationHospital.setUpdateTime(DateUtils.getNowDate());
        examinationHospital.setUpdateBy(ShiroUtils.getSysUser().getLoginName());
        examinationHospital.setUpdateName(ShiroUtils.getSysUser().getUserName());
        return examinationHospitalMapper.insertExaminationHospital(examinationHospital);
    }

    /**
     * 修改体检医院
     * 
     * @param examinationHospital 体检医院
     * @return 结果
     */
    @Override
    public int updateExaminationHospital(ExaminationHospital examinationHospital)
    {
        examinationHospital.setUpdateTime(DateUtils.getNowDate());
        examinationHospital.setUpdateBy(ShiroUtils.getSysUser().getLoginName());
        examinationHospital.setUpdateName(ShiroUtils.getSysUser().getUserName());
        return examinationHospitalMapper.updateExaminationHospital(examinationHospital);
    }

    /**
     * 批量删除体检医院
     * 
     * @param ids 需要删除的体检医院主键
     * @return 结果
     */
    @Override
    public int deleteExaminationHospitalByIds(String ids)
    {
        return examinationHospitalMapper.deleteExaminationHospitalByIds(Convert.toStrArray(ids),ShiroUtils.getSysUser().getLoginName());
    }

    /**
     * 删除体检医院信息
     * 
     * @param id 体检医院主键
     * @return 结果
     */
    @Override
    public int deleteExaminationHospitalById(Long id)
    {
        return examinationHospitalMapper.deleteExaminationHospitalById(id,ShiroUtils.getSysUser().getLoginName());
    }
}
